package com.ryskoo.basicdata.area.city.service;

import com.ryskoo.basicdata.area.city.domain.CityPO;
import com.ryskoo.basicdata.area.city.repository.ICityRepository;
import com.ryskoo.framework.core.service.BasicServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * @author qyc
 */
@Service
public class CityServiceImpl extends BasicServiceImpl<CityPO> implements ICityService {
    @Autowired
    private ICityRepository cityRepository;

    @PostConstruct
    public void init() {
        this.setDao(cityRepository);
    }

	@Override
	public List<CityPO> getCitysByProvinceId(String provinceId) {
		if(StringUtils.isBlank(provinceId)){
			return null;
		}
		return cityRepository.getCitysByProvinceId(provinceId);
	}

	@Override
	public CityPO getByEntityNo(String entityNo) {
		return cityRepository.getByEntityNo(entityNo);
	}
}
